#安装maven
mkdir /usr/local/maven
cp settings.xml /usr/local/maven
cd /usr/local/maven
#下载maven安装包
curl -o apache-maven-3.6.3-bin.tar.gz https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
tar -zxvf apache-maven-3.6.3-bin.tar.gz
rm apache-maven-3.6.3-bin.tar.gz
#追加maven的系统环境变量(所有用户皆可使用)
echo 'export M2_HOME=/usr/local/maven/apache-maven-3.6.3' >>/etc/environment
echo 'export CLASSPATH=$CLASSPATH:$M2_HOME/lib' >>/etc/environment
echo 'export PATH=$PATH:$M2_HOME/bin' >>/etc/environment
#追加maven的用户环境变量
echo 'export M2_HOME=/usr/local/maven/apache-maven-3.6.3' >>/etc/profile
echo 'export CLASSPATH=$CLASSPATH:$M2_HOME/lib' >>/etc/profile
echo 'export PATH=$PATH:$M2_HOME/bin' >>/etc/profile
#新建maven仓库
mkdir repository
#修改maven的配置文件
# rm apache-maven-3.6.3/conf/settings.xml
mv settings.xml apache-maven-3.6.3/conf

#重启
reboot